import {useAppTheme} from 'tsun-smart-ui';
import {useEffect} from 'react';
import {Platform, StatusBar} from 'react-native';

export const useStatusBarStyle = () => {
  const theme = useAppTheme();
  useEffect(() => {
    StatusBar.setBarStyle(theme.isDark ? 'light-content' : 'dark-content');
    if (Platform.OS === 'android') {
      StatusBar.setTranslucent(true);
      StatusBar.setBackgroundColor(
        theme.isDark ? theme.colors?.background?.primary! : 'transparent',
      );
    }
  }, [theme.isDark]);
};
